package com.gry.mystring;

import java.util.Scanner;

public class StringDemo8 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        String s;

        while (true) {
            System.out.println("请输入数字");
            s = sc.next();
            if (!judgStr(s)) {
                System.out.println("输入有误,请重新输入");
                continue;
            }
            break;
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            int num = c - 48;
            sb.append(numConversion(num));
        }
        System.out.println(sb);

    }
    public static String numConversion(int num){
        String[] arr = {"","Ⅰ","Ⅱ","Ⅲ","Ⅳ","Ⅴ","Ⅵ","Ⅶ","Ⅷ","Ⅸ"};
        return arr[num];
    }

    public static boolean judgStr(String s) {
        if (s.length() > 9) {
            return false;
        }
        for (int i = 0; i < s.length(); i++) {
            char c = s.charAt(i);
            if (c < '0' && c > '9') {
                return false;
            }
        }
        return true;
    }
}
